<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/login', 'Admin\LoginController@login');
Route::post('/login', 'Admin\LoginController@login');
Route::get('/updatepwd', 'Admin\LoginController@updatePwd');


Route::middleware(['myguest'])->namespace('Admin')->group(function () {
    Route::get('/', 'HomeController@index')->name('dashboard');
    Route::get('/logout', 'LoginController@logout');
    Route::get('/welcome', 'HomeController@welcome');

    Route::middleware(['myauth'])->group(function () {
        Route::get('/roles', 'RoleController@index')->name('roles-list');
        Route::match(['get','post'], '/roles/add', 'RoleController@add')->name('roles-add');
        Route::match(['get','post'], '/roles/update', 'RoleController@update')->name('roles-update');
        Route::post('/roles/delete', 'RoleController@delete')->name('roles-delete');
        Route::match(['get','post'],'/roles/assign', 'RoleController@assign')->name('roles-assign');

        Route::get('/permissions', 'PermissionController@index')->name('permissions-list');
        Route::match(['get','post'], '/permissions/add', 'PermissionController@add')->name('permissions-add');
        Route::match(['get','post'], '/permissions/update', 'PermissionController@update')->name('permissions-update');
        Route::post('/permissions/delete', 'PermissionController@delete')->name('permissions-delete');

        Route::get('/users', 'UserController@index')->name('users-list');
        Route::post('/users/updatestatus', 'UserController@updateStatus')->name('users-update-status');
        Route::match(['get','post'], '/users/update', 'UserController@update')->name('users-update');
        Route::match(['get', 'post'], '/users/add', 'UserController@add')->name('users-add');

        Route::post('/menus/add', 'SidebarController@add')->name('menus-add');
        Route::get('/menus', 'SidebarController@index')->name('menus-list');
        Route::match(['get', 'post'], '/menus/update', 'SidebarController@update')->name('menus-update');
        Route::post('/menus/delete', 'SidebarController@delete')->name('menus-delete');

        Route::prefix('project')->group(function () {
            Route::match(['get','post'], '/apply', 'ProjectController@apply')->name('project-apply');
            Route::get('/apply_list', 'ProjectController@applyList')->name('project-apply-list');

            Route::get('/check/list', 'ProjectController@checkList')->name('project-check-list');
            Route::post('/check', 'ProjectController@check')->name('project-check');

            Route::get('/execute/list', 'ProjectController@executeList')->name('project-execute-list');
            Route::post('/execute/start', 'ProjectController@executeStart')->name('project-execute-start');
            Route::post('/execute/complete', 'ProjectController@complete')->name('project-execute-complete');

            Route::get('/accept/list', 'ProjectController@acceptList')->name('project-accept-list');
            Route::post('/accept', 'ProjectController@accept')->name('project-accept');

            Route::get('/general/list', 'ProjectController@generalList')->name('project-general-list');
        });
    });

});


Route::get('/test', function(){
    return view('admin.project.test-list');
});

//Auth::routes();
//
//Route::get('/home', 'HomeController@index')->name('home');
